<template>
  <div class="workspace">
    <div class="top">
      <div class="greeting">
        {{ greeting }}，{{ $store.state.user.userInfo.name }}
      </div>
      <div class="time">
        {{ time }}  {{ week_list[week] }}
      </div>
    </div>
    <todayData />
    <orders style="margin-top: 15px;"/>
    <div class="products">
      <products style="margin-top: 15px;"/>
      <inventory style="margin-top: 15px;"/>
    </div>

    <orderDeatail style="margin-top: 15px;"/>
  </div>
</template>

<script>
import {format,greeting} from '@/utils/formValidate'
import todayData from '@/components/workspace/todayData.vue'
import inventory from '@/components/workspace/inventory.vue'
import orderDeatail from '@/components/workspace/orderDeatail.vue'
import orders from '@/components/workspace/orders.vue'
import products from '@/components/workspace/products.vue'
export default {
  components:{
    todayData,
    inventory,
    orderDeatail,
    orders,
    products
  },
  data() {
    return {
      greeting:'早上好',
      timeId:'',
      week_list:['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
      week:'',
      time:'',
    }
  },
  created() {
    var myDate = new Date();
    this.week = myDate.getDay()
    this.time = format(new Date().getTime());
    this.timeId = setInterval(()=>{
    this.time = format(new Date().getTime());
    }, 1000);

    this.greeting = greeting(myDate.getTime());
  },
  methods:{

  }
}
</script>

<style scoped>
.workspace{
  line-height:20px
}

.top{
  display: flex;
  justify-content: space-between;
}

.greeting{
  font-size: 28px;
  padding: 15px;
  /* font-weight:600; */
  font-family: Arial;
}

.time{
  font-size: 18px;
  padding: 15px;
}

.products{
  width: 100%;
  display: flex;
  justify-content: space-between;
  
}
</style>